package com.ruoyi.web.controller.hk;

import java.util.List;
import javax.print.Doc;
import javax.servlet.http.HttpServletResponse;

import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.hk.domain.DocDoctorRegist;
import com.ruoyi.hk.service.IDocDoctorRegistService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 医生审核Controller
 * 
 * @author ruoyi
 * @date 2025-08-16
 */
@RestController
@RequestMapping("/hk/docregist")
public class DocDoctorRegistController extends BaseController
{
    @Autowired
    private IDocDoctorRegistService docDoctorRegistService;

    /*
    * 医生审核确定
    * */
    @PostMapping("/confirmAudit")
    public ResponseEntity<?> confirmAudit(@RequestBody DocDoctorRegist docDoctorRegist){
        Integer result = docDoctorRegistService.confirmAudit(docDoctorRegist);
        return ResponseEntity.ok(result);
    }

    /**
     * 查询医生审核列表
     */
    @PreAuthorize("@ss.hasPermi('hk:docregist:list')")
    @GetMapping("/list")
    public TableDataInfo list(DocDoctorRegist docDoctorRegist)
    {
        startPage();
        List<DocDoctorRegist> list = docDoctorRegistService.selectDocDoctorRegistList(docDoctorRegist);
        return getDataTable(list);
    }

    /**
     * 导出医生审核列表
     */
    @PreAuthorize("@ss.hasPermi('hk:docregist:export')")
    @Log(title = "医生审核", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DocDoctorRegist docDoctorRegist)
    {
        List<DocDoctorRegist> list = docDoctorRegistService.selectDocDoctorRegistList(docDoctorRegist);
        ExcelUtil<DocDoctorRegist> util = new ExcelUtil<DocDoctorRegist>(DocDoctorRegist.class);
        util.exportExcel(response, list, "医生审核数据");
    }

    /**
     * 获取医生审核详细信息
     */
    @PreAuthorize("@ss.hasPermi('hk:docregist:query')")
    @GetMapping(value = "/{doctorRegistId}")
    public AjaxResult getInfo(@PathVariable("doctorRegistId") Long doctorRegistId)
    {
        return success(docDoctorRegistService.selectDocDoctorRegistByDoctorRegistId(doctorRegistId));
    }

    /**
     * 新增医生审核
     */
    @PreAuthorize("@ss.hasPermi('hk:docregist:add')")
    @Log(title = "医生审核", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DocDoctorRegist docDoctorRegist)
    {
        return toAjax(docDoctorRegistService.insertDocDoctorRegist(docDoctorRegist));
    }

    /**
     * 修改医生审核
     */
    @PreAuthorize("@ss.hasPermi('hk:docregist:edit')")
    @Log(title = "医生审核", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DocDoctorRegist docDoctorRegist)
    {
        return toAjax(docDoctorRegistService.updateDocDoctorRegist(docDoctorRegist));
    }

    /**
     * 删除医生审核
     */
    @PreAuthorize("@ss.hasPermi('hk:docregist:remove')")
    @Log(title = "医生审核", businessType = BusinessType.DELETE)
	@DeleteMapping("/{doctorRegistIds}")
    public AjaxResult remove(@PathVariable Long[] doctorRegistIds)
    {
        return toAjax(docDoctorRegistService.deleteDocDoctorRegistByDoctorRegistIds(doctorRegistIds));
    }
}
